// skin_control.h
#ifndef _SKIN_CONTROL_H
#define _SKIN_CONTROL_H

#include "skin_base.h"

#if SDL_BYTEORDER == SDL_BIG_ENDIAN
    #define rmask 0xff000000
    #define gmask 0x00ff0000
    #define bmask 0x0000ff00
    #define amask 0x000000ff
#else
    #define rmask 0x000000ff
    #define gmask 0x0000ff00
    #define bmask 0x00ff0000
    #define amask 0xff000000
#endif

typedef enum CONTROL_EVENT
{
	SKIN_EVENT_QUIT		= SDL_USEREVENT + 1,
	SKIN_EVENT_INITWIN,
	SKIN_EVENT_REFRESH,
	SKIN_COMMAND,
} CONTROL_EVENT;

typedef enum CONTROL_CLOSE_OPTION
{
	CONTROL_CLOSE_NORMAL = 0,
	CONTROL_CLOSE_FORCED,
} CONTROL_CLOSE_OPTION;

typedef enum CONTROL_STATE
{
	BUTTON_NORMAL 	= 0x00,
	BUTTON_HOVER  	= 0x01,
	BUTTON_CLICKED  = 0x02,
	BUTTON_FOCUSED	= 0x10,
} CONTROL_STATE;

// skin control
typedef enum SKIN_CLIENT_TYPE
{
	CONTROL_STATIC = 0,
	CONTROL_BUTTON,
	CONTROL_COMBOBOX,
	CONTROL_LISTBOX,
	CONTROL_LIST,
	CONTROL_TREE,
	CONTROL_EDIT,
	CONTROL_PROGRESS,
	CONTROL_SLIDE,
	CONTROL_GAUGE,
} SKIN_CLIENT_TYPE;

PSKIN_CLIENT 	skin_create_control	(PSKIN_WINDOW pwnd, int object_type, int x, int y, int cx, int cy, int client_id, const char* object_name);
int				skin_close_control	(PSKIN_CLIENT p, int option);
PSKIN_CLIENT 	skin_control_update	(PSKIN_CLIENT control);
PSKIN_CLIENT 	skin_control_move	(PSKIN_CLIENT control, int x, int y, int cx, int cy, int option);
void		 	skin_control_removeall(PSKIN_WINDOW wnd);
int 			skin_draw_controls(PSKIN_WINDOW pwnd);

// control based interfaces
int 		skin_control_onpaint  			(void* self);
int         skin_control_onkeydown       	(void* self, SDL_Event* e);
int         skin_control_onkeyup          	(void* self, SDL_Event* e);
int         skin_control_onmousemove		(void* self, SDL_Event* e);
int         skin_control_onmousebuttondown	(void* self, SDL_Event* e);
int         skin_control_onmousebuttonup  	(void* self, SDL_Event* e);

#endif // _SKIN_SONTROL_H